package com.itshizhan.itjidancideveloper.models;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.models.auth.In;
import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.math.BigInteger;
import java.util.Date;

@JsonIgnoreProperties(value = { "hibernateLazyInitializer", "handler" })
@Data
@EntityListeners(AuditingEntityListener.class)
@Entity
@Table(name = "article")
public class Article {
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Integer id;
	private String title;
	@Column(name = "created_by")
	private String createdBy;
	@Column(name = "content_md")
	private  String contentMd;
	@Column(name = "content_html")
	private String contentHtml;
	private Integer state = 2;
	@Column(name = "page_view")
	private Integer pageView;

	@Column(name = "user_id")
	private Long userId;

	@ManyToOne(fetch = FetchType.LAZY,cascade = CascadeType.MERGE)
	@JoinColumn(name = "category_id",referencedColumnName = "id")
	private ArticleCategory articleCategory;

	@CreatedDate
	@Column(name = "create_time")
	private Date createTime;

	@LastModifiedDate
	@Column(name = "update_time")
	private Date updateTime;

}
